# $Id$
# Maintainer: Qurban Ullah <qurbanullah@avouch.org>
# Contributor: Qurban Ullah <qurbanullah@avouch.org>

pkgbase=oxygen
pkgname=(oxygen oxygen-kde4)
pkgver=5.13.5
pkgrel=1
arch=(x86_64)
url='https://www.kde.org/workspaces/plasmadesktop/'
license=(LGPL)
makedepends=(frameworkintegration kcmutils kdecoration extra-cmake-modules kdoctools kdelibs automoc4 python)
groups=('kde-plasma')
repo=('core')
source=("https://download.kde.org/stable/plasma/$pkgver/$pkgname-$pkgver.tar.xz"{,.sig})
sha256sums=('3f0544c0376ac98f063dca14f7c0414a69cff775b1e67e4033922d5630a17e2c'
            'SKIP')
validpgpkeys=('2D1D5B0588357787DE9EE225EC94D18F7F05997E'  # Jonathan Riddell
              '348C8651206633FD983A8FC4DEACEA00075E1D76'  # KDE Neon
              'D07BD8662C56CB291B316EB2F5675605C74E02CF') # David Edmundson

prepare() {
  mkdir -p build{,-kde4}
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DBUILD_TESTING=OFF
  make ${MAKEFLAGS}
  cd ..

  cd build-kde4
  cmake ../$pkgname-$pkgver \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_TESTING=OFF \
    -DUSE_KDE4=ON
  make ${MAKEFLAGS}
}

package_oxygen() {
  pkgdesc='KDE Oxygen style'
  depends=(frameworkintegration kdecoration kcmutils kwayland hicolor-icon-theme)
  conflicts=(oxygen-cursors)
  replaces=(oxygen-cursors)
  groups=(plasma)

  cd build
  make DESTDIR="$pkgdir" install
}

package_oxygen-kde4() {
  pkgdesc='KDE Oxygen style for KDE4 applications'
  depends=(kdelibs)

  cd build-kde4
  make DESTDIR="$pkgdir" install

  # needed so that pure Qt4 apps are correctly themed
  install -d -m755 "$pkgdir"/usr/lib/qt4/plugins/styles
  ln -s /usr/lib/kde4/plugins/styles/oxygen.so "$pkgdir"/usr/lib/qt4/plugins/styles
}
